﻿

using OpenCvSharp;

using Xc.DataAccess.CodeReader.Properties;
using Xc.DataAccess.Core;

namespace Xc.DataAccess.CodeReader.Models.Filters
{
    /// <summary>
    /// 缩减颜色空间
    /// </summary>
    [Filter("修改颜色",FilterType.Algorithm)]

    public class AlgorithmColorChange : FilterBase
    {
        /// <summary>
        /// 掩膜
        /// </summary>
        [InputParameter("掩膜")]
        public Mat Marsk { get; set; }
        /// <summary>
        /// 红
        /// </summary>
        [InputParameter("红")] public float Red { get; set; }
        /// <summary>
        /// 绿
        /// </summary>
        [InputParameter("绿")] public float Green { get; set; }
        /// <summary>
        /// 蓝
        /// </summary>
        [InputParameter("蓝")] public float Blue { get; set; }
        internal override ResultData<Mat> UseChannel(Mat mat, FilterBase[] filterInfos, FilterBase preFilterBase)
        {
            Mat result=new Mat();
            Cv2.ColorChange(mat, Marsk, result, Red, Green, Blue);
            return ResultData<Mat>.Accept(TextResource.filter_action_complete, result);
        }
    }
}
